package be.jabapage.snooker.service.competition.api;

import java.util.Set;

import be.jabapage.snooker.exception.EntityNotFoundException;
import be.jabapage.snooker.jdo.competition.CompetitionGame;

/**
 * 
 * CRUD service for the CompetitionGameGame
 * @author axesq
 *
 */
public interface ICompetitionGameService {

	/**
	 * 
	 * Store or update a CompetitionGame in the data store
	 * @param CompetitionGame
	 */
	void store(CompetitionGame competitionGame);

	/**
	 * Retrieve a CompetitionGame by the key
	 * @param key
	 * @return CompetitionGame
	 * @throws EntityNotFoundException when no record is found
	 */
	CompetitionGame retrieve(Long key) throws EntityNotFoundException;

	/**
	 * Delete the instance with this key from the datastore.
	 * @param key
	 * @throws EntityNotFoundException when the instance is not found;
	 */
	void delete(Long key) throws EntityNotFoundException;

	/**
	 * 
	 * Retrieve all the games for one single team.
	 * @param teamId the id of the record in TeamCompetitionParticipation
	 * @return Set of all the games that belongs to this team.  Home or Away
	 */
	Set<CompetitionGame> retrieveForTeam(Long teamId);

	/**
	 * 
	 * Retrieve the {@link CompetitionGame} for a single team and a weeknumber
	 * @param teamId the id of the record in TeamCompetitionParticipation
	 * @param weekId the week
	 * @return the record for {@link CompetitionGame}
	 * @throws EntityNotFoundException when no record is found.
	 */
	CompetitionGame retrieveForTeamAndWeek(Long teamId, Long weekId) throws EntityNotFoundException;
}
